package com.zhao.dao.impl;

import com.zhao.dao.IBlackListDao;
import com.zhao.dao.IGameAnaylysisResult;
import com.zhao.entity.BlackList;
import com.zhao.entity.GameAnaylysisResultBean;
import com.zhao.utils.DBCPUtil;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;
import java.util.List;

/**
 * Description: 游戏玩家黑名单操作dao层接口实现类<br/>
 *
 * @author 柒柒
 * @version : 1.0
 * @ClassName GameAnaylysisResultImpl <br/>
 * Copyright (c) ，2020 ， 赵 <br/>
 * Date： 2020/12/11 16:56
 */

public class GameAnaylysisResultImpl implements IGameAnaylysisResult {
    private QueryRunner qr = new QueryRunner(DBCPUtil.getConnectionPool());

    @Override
    public void save(GameAnaylysisResultBean bean) {
        try {
            qr.update("insert into tb_game_anaylysis_result values(?,?,?,?,?,?,?,?,?,?) on duplicate key update " +
                            "newAddUserCnt=?," +
                            "activeUserCnt=?," +
                            "nextDayRate=?," +
                            "twoDayRate=?," +
                            "threeDayRate=?," +
                            "fourDayRate=?," +
                            "fiveDayRate=?," +
                            "sixDayRate=?," +
                            "sevenDayRate=?",
                    bean.getDate(),
                    bean.getNewAddUserCnt(),
                    bean.getActiveUserCnt(),
                    bean.getNextDayRate(),
                    bean.getTwoDayRate(),
                    bean.getThreeDayRate(),
                    bean.getFourDayRate(),
                    bean.getFiveDayRate(),
                    bean.getSixDayRate(),
                    bean.getSevenDayRate(),

                    bean.getNewAddUserCnt(),
                    bean.getActiveUserCnt(),
                    bean.getNextDayRate(),
                    bean.getTwoDayRate(),
                    bean.getThreeDayRate(),
                    bean.getFourDayRate(),
                    bean.getFiveDayRate(),
                    bean.getSixDayRate(),
                    bean.getSevenDayRate()
                    );
        } catch (SQLException e) {
            e.printStackTrace();
            throw new RuntimeException("保存到db中失败了！异常信息是：" + e.getMessage());
        }
    }
}















